<template>
  <div class="about">
<!--    <h1>This is an about page</h1>-->
<!--      <content-main ref="contentMainRef" :mainData="mainData"></content-main>-->
<!--      <countTo-->
<!--          :startVal="0"-->
<!--          :endVal="8056"-->
<!--          :duration="2000"-->
<!--      ></countTo>-->
              <tw-table
                  url="/business/driver/page"
                  :columns="mainData.columns"
                  :tableBtns="mainData.tableBtns"
                  :headBtns="mainData.headBtns"
              ></tw-table>
  </div>
</template>

<script setup lang="tsx">

let { proxy } = getCurrentInstance()

let drawer = $ref(false)
let drawerRef = $ref(null)
let title = $ref('')
let contentMainRef = $ref(null)
let objMsg = {0:'发送中', 1:'发送成功', 2:'发送失败'}
let mainData = reactive({
    tableUrl: '/company/pageList',
    showIndex: true,
    foldNumber: 3,
    columns: [
        { prop: 'simNo', label: 'SIM卡号' },
        { prop: 'vehicleNum', label: '车牌号' },
        { prop: 'sendTime', label: '发送/回复时间' },
        { prop: 'templateName', label: '模板名称' },
        { prop: 'message', label: '发送/回复内容' },
        // { prop: 'errMsg', label: '失败原因'},
        { prop: 'status', label: '发送结果' , formatter:(row)=> {
                if(row.status == 2){
                    return <p class="danger">{objMsg[row.status]}</p>
                }else {
                    return objMsg[row.status]
                }
            } },
        { prop: 'lastModifyUserName', label: '操作人'},
    ],
    headBtns: [
        {icon: 'add', name: '发送消息', click: (row) => {
                title = '发送消息'
                drawerRef.setFormData()
                drawer = true
            },
        },
    
    ],
    tableBtns: {
        prop: 'btns',
        label: '操作',
        fixed: 'right',
        width: 60,
        btns: [
            { icon: 'zhongxinfasong', name: '重新发送', formatter: (row) => row.status == 2, click: (row)=> {
                    title = '重新发送'
                    drawerRef.setFormData(row)
                    drawer = true
                } },
        ],
    },
    formData: {
        "endDay": "",
        pageNumber: 1,
        pageSize: 25,
        vehicleNum:'',
        "simNo": "",
        "startDay": "",
        "status": "",
    },
    lists: [
        { key: 'vehicleNum', label: '车牌号', placeholder: '请输入车牌号'},
        {label: '发送结果', key: 'status', type: 'select', children: [{label: '发送中',value: 0},{label: '发送成功',value: 1},{label: '发送失败',value: 2}], placeholder: '请选择发送结果'},
    ],
})



const getTable = () => {
    contentMainRef.getTable()
}
</script>

<style>

</style>
